#include "GCriticalSection.h"
#include "GError.h"

namespace GThread
{
	// Description: Constructor
	// Return:
	// Notes:
	// -----------------------------------------------------
	GCriticalSection::GCriticalSection()
	{
		Section = NULL;
		SpinCount = 0;
	}

	// Description: Destructor
	// Return:
	// Notes:
	// -----------------------------------------------------
	GCriticalSection::~GCriticalSection()
	{
		Release( );
	}

	// Description: Returns the spin count which is used as a loop iteration counter before entering a critical section.
	// Return:
	// Notes:
	// -----------------------------------------------------
	GUInt32 GCriticalSection::GetSpinCount() const
	{
		return SpinCount;
	}

	// Description: Returns ture if cs is created
	// Return:
	// Notes:
	// -----------------------------------------------------
	bool GCriticalSection::IsCreated() const
	{
		return Section != NULL;
	}

}